from django.db import models

# Create your models here.
from django.db import models



class User(models.Model):
    username = models.CharField(max_length=255)
    email = models.EmailField(unique=True)
    password = models.CharField(max_length=255)
    phone_number = models.CharField(max_length=20)
    address = models.CharField(max_length=500, blank=True, null=True)
    birthday = models.DateField(blank=True, null=True)
    created_at = models.DateTimeField(auto_now_add=True)

    class Meta:
        db_table = 'users'  # 指定表名
    def __str__(self):
        return self.username

class Manager(models.Model):
    username = models.CharField(max_length=255)
    email = models.EmailField(unique=True)
    password = models.CharField(max_length=255)
    phone_number = models.CharField(max_length=20)
    address = models.CharField(max_length=500, blank=True, null=True)
    birthday = models.DateField(blank=True, null=True)
    created_at = models.DateTimeField(auto_now_add=True)

    class Meta:
        db_table = 'manager'  # 指定表名
    def __str__(self):
        return self.username

class WeatherData(models.Model):
    城市 = models.CharField(max_length=255, blank=True, null=True)
    时间 = models.CharField(max_length=255, blank=True, null=True)
    温度 = models.FloatField(blank=True, null=True)
    体感温度 = models.FloatField(blank=True, null=True)
    天气情况 = models.CharField(max_length=255, blank=True, null=True)
    风力等级 = models.CharField(max_length=255, blank=True, null=True)
    风向 = models.CharField(max_length=255, blank=True, null=True)
    风向角度 = models.CharField(max_length=255, blank=True, null=True)
    风速 = models.FloatField(blank=True, null=True)
    湿度 = models.FloatField(blank=True, null=True)
    降水量 = models.FloatField(blank=True, null=True)
    大气压强 = models.FloatField(blank=True, null=True)
    能见度 = models.FloatField(blank=True, null=True)

    class Meta:
        db_table = 'cleaned_weatherdata'  # 指定表名

    def __str__(self):
        return self.城市

class LishiWeather(models.Model):
    city = models.CharField(max_length=255)
    日期 = models.CharField(max_length=255, blank=True, null=True)
    星期 = models.CharField(max_length=255, blank=True, null=True)
    最高温度 = models.FloatField(blank=True, null=True)
    最低温度 = models.FloatField(blank=True, null=True)
    天气 = models.CharField(max_length=255, blank=True, null=True)
    风向 = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        db_table = 'lishiweathers'  # 指定表名
    def __str__(self):
        return self.city